﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if IE 6 ]>
  <html class="ie6">
  <![endif]-->
  <!--[if IE 7 ]>
    <html class="ie7">
    <![endif]-->
    <html xmlns="http://www.w3.org/1999/xhtml">
      
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
       <title>{config.webtitle}</title>
<meta content="{config.webkeyword}" name="keywords" />
<meta content="{config.webdescription}" name="description" />
        <!--css-->
        <%template src="cssjs.html" %>
          <!--/css-->
        <link href="<%templateskin%>/css/from/from.css" rel="stylesheet" type="text/css"
/>
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/from/jquery.ui.core.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/from/jquery.ui.theme.css">
<link rel="stylesheet" type="text/css" href="<%templateskin%>/css/from/jquery.ui.datepicker.css">
<script>

    function CartAmountTotal(obj) {
        if (isNaN($(obj).val())) {

            $(obj).val("0");
        }
        var order_amount = 0;
        $(".tetinput_small").each(function () {
            order_amount = order_amount + ($(this).val() * $(this).attr("title"));
        });

        $("#goods_amount").text(order_amount.toFixed(2));
        $("#goods_amount").text(order_amount.toFixed(2));
        //  $("goods_amount").text("");
        //$("#price1").text(order_amount.toFixed(2));
    }
</script>
      </head>
      
      <body>
        <div class="wrapper">
          <!--Header-->
          <%template src="_header.html" %>
            <!--/Header-->
     
            <div id="page_modules">
                    <form name="order_form" id="order_form" url="{config.webpath}tools/submit_ajax.ashx?action=neworder_save">
                   
              <div class="center_wrapper center_lineGreen clearfix">
                <div class="left_con_m">
                  <div class="tile_left_m">
                    
          <div class="tile_en"><em class="black">Order</em><em class="darkGreen"> YOUR</em><em class="lightGreen">JUICEUP</em></div>
                  </div>
                  <div class="order_warp">
                    <div class="order_step">
                      <ul>
                        <li>
                          Step 1: Select start date
                        </li>
                        <li class="selected">
                       Step 2: Confirm order
                        </li>
                        <li>
                          Step 3: Payment
                        </li>
                      </ul>
                    </div>
               <!--     <div class="orderNum">
               注：送达日期为您选择的排毒开始日期的前一天
                    </div>-->
                    <div class="orderInfoWarp">
                                   <%csharp%>  if (new_get_cart_list().Count == 0)
                {
                    HttpContext.Current.Response.Redirect(linkurl("goods"));
                } <%/csharp%>
                     <%set int addcount=0%>
                     <%set int addfive=0 %>
                   <%set int modelt__loop__id=0;%>
                      <%set IList<ihongma.Model.c_tiems> ls1=new_get_cart_list()%>
                     
                <%set DataTable category_list1=get_article_list("goods", 0, 10, "category_id!=44", "id desc")%>
                     <%foreach(ihongma.Model.c_tiems modelt in ls1)%>
                     <%csharp%>modelt__loop__id++;<%/csharp%>
                     
                          <div class="orderInfo" id="info{modelt__loop__id}">
                            <span class="num">
                              {modelt__loop__id}.
                            </span>
                            <ul>
                             <%set var goodsm=modelt.items[0]; %>
                               <%if({modelt.type}==3) %>
                            
                              <li>
                           
                                <span class="tile">
                                   selection:
                                </span>
                                
                               <span>{goodsm.title}</span>
                              <input id="Hidden3" name="type{modelt__loop__id}" type="hidden" value="{goodsm.id}" />
                              </li>
                              <%else%>
                             <input id="Hidden2" name="type{modelt__loop__id}" type="hidden" value="{goodsm.id}" />
                               <li>     <span class="tile"> selection:</span>
<span>{goodsm.title}</span></li>
<li> </li><li>

                  <span class="tile" >quantity：</span>
                  <input type="text" value="{goodsm.quantity}" title="{goodsm.price}"  onblur="CartAmountTotal(this);" id="number" name="number{modelt__loop__id}" class="tetinput_small" />
                  <span class="tet">Unit: each piece</span>
                </li>
                                <%/if%>
                                   <%if({modelt.type}==2)%>
<input id="Hidden5" type="hidden" name="iscounte" value="1" />
                                  
                                   <%/if%>
                                <%if({modelt.type}!=2)%>
                              <li>
                                <span class="tile">
                                   date: 
                                </span>
                                 
                                   <%if({modelt.type}==3) %>
                                    <input id="Hidden4" type="hidden"  name="date{modelt__loop__id}" value="<%datetostr(modelt.shiptime,yyyy-MM-dd)%>" />
                                   <span> <%datetostr(modelt.shiptime,yyyy-MM-dd)%></span>
     <span class="tet"> Reminder: Delivery date is one day before detox date</span>
                                <%else%>
                                   <input class="tetinput el"  name="date{modelt__loop__id}" id="date{modelt__loop__id}" type="text" value="<%datetostr(modelt.shiptime,yyyy-MM-dd)%>" />
                                <%/if%>
                              </li>
                                <%if({modelt.type}==3) %>
                              <li>
                                <span class="tile">
                                  Delivery time:
                                </span>
                                <span class="rule-single-select">
                                <select class="tetselect"  name="time{modelt__loop__id}" >
                                  <option selected="" value="1">
                                   2:00pm-6:00pm
                                  </option>
                                  <option value="2">
                                   6:00pm-10:00pm
                                  </option>
                                </select></span>
                              </li>
                              <%/if%>
                              <%if(IsUserLogin())%>
                                <li>
                                  <span class="tile">
                                    Delivery address:
                                  </span>
                                  <span class="rule-single-select">
                                  <select class="tetselect  addrss" name="address{modelt__loop__id}" class="rule-single-select" onchange="test(this)">
                                    <%set DataTable list1=get_user_address(userModel.id)%>
                                      <%loop item list1%>
                                     
                                    <%csharp%>addcount++;<%/csharp%>
                                        <option value="{item[id]}" title="{item[field1]}" <%if({item[status]}=="1")%>
                                        <%if({item[field1]}=="50")%>
                                        <%csharp%>addfive++;<%/csharp%>
                                        <%/if%>
                                          selected="selected"
                                          <%/if%>
                                            >{item[address]}--{item[mobile]}--<%if({item[field1]}=="50")%> 五环外<%else%>五环内<%/if%>
                                        </option>
                                        
                                        <%/loop%>
                                        <option value="0">Add new address</option>
                                  </select></span>
                                </li>
                                <%/if%>
                                <%/if%>
                            </ul>
                          </div>
                          <%/foreach%>
<input id="Hidden1" name="addresscount" value="<%=addcount %>" type="hidden" />
                        <input id="addcount" name="addcount" value="<%=modelt__loop__id %>" type="hidden" />
                            <input id="addfive" name="addfive" value="<%=addfive%>" type="hidden" />
                              <input id="ordertype" name="ordertype" type="hidden" value="<%=ls1[0].type%>" />
                    </div>
                  </div>
                </div>
                <div class="right_con_m">
                 <p class="hotLineRight">Please feel free to inquire:<br />order@juiceupcleanse.com
										</p>
                  <div class="orderConf">
                    <h5>
                   Confirm order:
                    </h5>
                    <div class="price">
                      Product：¥ <span id="goods_amount">{cartModel.payable_amount}</span> RMB
                    </div>
                    <div class="shipping">
                      Delivery charge：¥ <span id="shipping">0</span> RMB
                    </div>
                       <%set bool libool=true%>
                       <%if(IsUserLogin())%>
                       <%set DataTable liaocheng=getliaocheng(userModel.id)%>
                       <%if(liaocheng.Rows.Count>0)%>
                      <%csharp%>libool=false;<%/csharp%>
                      <%if(ls1[0].type==3)%>
                       <div class="moreOrder">
                      <label class="tile">
                     
                        使用疗程卡
                   
                      </label>
                      <div id="Div1">
                        <!--<div>
                          输入人数 最终价格会便宜哦
                        </div>-->
                             <%set string listr=""%>
                        <div class="moreOrder_l" >
<select id="selliaochng" name="selliaochng" onchange="liaochengTotal(this)">
                              <%loop lh liaocheng%>
                            <%csharp%>listr=liaochengtype({lh[type]},{lh[number]},{lh[state]},{lh[field]},{lh[endtime]});<%/csharp%>
                                <option value="{lh[id]}" title="{lh[number]}">{listr}</option>
                                <%/loop%>
                            </select>
                        </div>
                      </div>
                    </div>
                     <%/if%>
                     <%/if%>
                      <%/if%>
                    <%if(ls1[0].type==3&&libool) %>
                     
                    <div class="moreOrder">
                      <label class="tile">
                        <input type="checkbox"   class="checkall"  name="" id="cbox" value="radio" />
                   GroupPurchasing
                      </label>
                      <div id="moreOrderInfo">
                        <div>
                         Please enter numbers of person and the total price will adjust accordingly.
                        </div>
                        <div class="moreOrder_l">
                          <img class="floatleft" src="<%templateskin%>/images/icon_x.gif" width="22" height="28"
                          />
                          <input class="tetinput_sl" disabled="disabled" id="multiTEXT" name="multi" type="text" value=""
                          />
                          <input type="button"   value="Submit" id="sbu"  onclick="HowAmountTotal()" class="btn" style="background-color: #BEBEBE;"   />
                        </div>
                      </div>
                    </div>
           <div class="orderGift">
                      <div>
                        <label class="tile">
                          <input type="checkbox"   class="checkall" id="cbox2" name="" value="radio" />
                          Gift Card
                        </label>
                        <input
                      class="btn" id="libtn" disabled="disabled" style="background-color: #BEBEBE;"  value="validation" type="button" onclick="lipinTotal();"   /> 
                      </div>
                      <input class="tetinput" disabled="disabled" id="liping" name="liping" placeholder="Please enter the gift card code"  type="text"
                      value="" />
                    </div>
                    <div class="orderDiscount">
                      <div>
                        <label class="tile">
                          <input type="checkbox" class="checkall" id="cok1" name=""  value="radio" />
                          Discount Card
                        </label>
                        <input class="btn" id="zhe" style="background-color: #BEBEBE;"  value="validation" type="button"   onclick="zheTotal();"/>
                          
                        
                      </div>
<input class="tetinput" name="zhe" id="ku" type="text" disabled="disabled" value=""  placeholder="Please enter the coupon code" />
                    </div>
                     
                   
                    
                    <%/if%>
                   <%if(ls1[0].type==3)%>
                    <div class="moreOrder">
                      <label class="tile" style="font-size: 10px;color: #eb007b;">
                       <input type="checkbox" class="checkall" id="chkCoolbag" name=""  value="radio" />
                      JuiceUp recyclable cooler bag¥28
                      </label>
                      <div id="Div2">
                        <!--<div>
                          JuiceUp时尚冷藏包 
                        </div>-->
                        <div class="moreOrder_l">
                          <img class="floatleft" src="<%templateskin%>/images/icon_x.gif" width="22" height="28"
                          />
                          <input class="tetinput_sl" disabled="disabled" id="texCoolbag" name="texCoolbag" type="text" value=""
                          />
                          <input type="button"   value="提交" id="butCoolbag"  onclick="CoolbagAdd();" class="btn" style="background-color: #BEBEBE;"   />
                        </div>
                      </div>
                    </div>
                    
                    <%/if%>
                     <div class="payingPrice">
                      <span>
                        Total：
                      </span>
                      ¥ <span id="order_amount" style="display:inline">{cartModel.payable_amount}</span> RMB
                    </div>
 <input id="LNG" NAME="LNG" value="JuiceUpen" type="hidden" />
                     <input id="ddr" value="{cartModel.payable_amount}" type="hidden" />
                    <div class="paymentList">
                      <h6>
                        Payment methods:
                      </h6>
                      <%set string  strwhere="is_lock=0"%>
                       <%if(ls1[0].type==1||ls1[0].type==2||!libool) %>
                      <%csharp%>strwhere=strwhere+" and id!=1";  <%/csharp%>
                      <%/if%>
                      <%set DataTable list2=get_payment_list(0, strwhere)%>
      <%loop dr1 list2%>
    
                      <label>
                      <input name="payment_id" type="radio" <%if({dr1[title]}=="在线支付")%>  checked="checked"<%/if%> value="{dr1[id]}" />
                        <%if({dr1[title]}=="在线支付")%>online payment  <%else if({dr1[title]}=="货到付款")%>cash on delivery <%else%>
                        {dr1[title]}<%/if%>

                      </label>
                      <%/loop%>
                    </div>
                    <div class="btn_next" >
                         <input id="btnSubmit" name="btnSubmit" type="submit" value="Submit" class="btn btn-success marL10" />
                      <!--<a href="javascript:void(0);">
                        确认支付
                      </a>-->
                    </div>
                      <input id="vids" value="0" type="hidden" />
                  </div>
                   <!--right-->
                <%template src="right.html" %>
                  <!--/right-->
            
                </div>
                  <script src="<%templateskin%>/js/jquery.ui.core.js" type="text/javascript"></script>
                 <script src="<%templateskin%>/js/jquery.ui.datepicker.js"></script>
<script src="<%templateskin%>/js/jquery.ui.datepicker-zh-TW.js"></script>
<script type="text/javascript" src="<%templateskin%>/js/layout.js"></script>
<script type="text/javascript" src="../../scripts/lhgdialog/lhgdialog.js?skin=idialog_1"></script>
<script type="text/javascript" src="<%templateskin%>/js/base.js"></script>
<link rel="stylesheet" href="{config.webpath}css/validate.css" />
	<script type="text/javascript" src="{config.webpath}scripts/jquery/jquery.form.min.js"></script>
    <script type="text/javascript" src="{config.webpath}scripts/jquery/Validform_v5.3.2_min.js"></script>
                <script  type="text/javascript">
                	Date.prototype.Format = function (fmt) { //author: meizz 
		        var o = {
		            "M+": this.getMonth() + 1, //月份 
		            "d+": this.getDate(), //日 
		            "h+": this.getHours(), //小时 
		            "m+": this.getMinutes(), //分 
		            "s+": this.getSeconds(), //秒 
		            "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
		            "S": this.getMilliseconds() //毫秒 
		        };
		        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
		        for (var k in o)
		            if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
		        return fmt;
		    }
              <%if(ls1[0].type==3) %>
                $(function(){if($("#addfive").val()!="0")
                {

                $("#shipping").text($("#addfive").val()*50);
                 
                }
                var goods_amount = $("#goods_amount").text(); //商品总金额
               var d=$("#shipping").text();
              // alert(3);
                var sellc=$("#selliaochng");
      if(sellc.length>0)
      {
   
       var data = $("#selliaochng").find("option:selected").attr("title");
      
       
      if($("#addcount").val()<=parseInt(data))
       {
    
        $("#goods_amount").text(0);
       order_amount=0;
       }
        }
                  var order_amount=parseFloat(goods_amount)+parseFloat(d);
                  
          
        $("#order_amount").text(order_amount.toFixed(2));
                });
                <%/if%>
                 //计算订单总金额
function HowAmountTotal() {

    var temp = $("#multiTEXT");
        if (isNaN(temp.val())) {
            alert('多人订购只能输入数字!');
            temp.focus();
            return;
        }
       
         Calculate();

    


}
function CoolbagAdd() {

    var temp = $("#texCoolbag");
        if (isNaN(temp.val())) {
            alert('只能输入数字!');
            temp.focus();
            return;
        }
       
         Calculate();

    


}
function liaochengTotal(obj)
{
var text= $(obj).find("option:selected").attr("title");

if(parseInt($("#addcount").val())>parseInt(text))
{
alert("您的疗程次数不足请选择单次订购");
return;
}
Calculate();
}
function zheTotal() {

    var temp = $("#ku");
        if (temp.val()=="") {
            alert('您输入的内容不能为空!');
            temp.focus();
            return;
        }
       
         Calculate();

}

function lipinTotal() {

    var temp = $("#liping");
        if (temp.val()=="") {
            alert('您输入的内容不能为空!');
            temp.focus();
            return;
        }
       
         Calculate();

}
                    $(function () {
                    
                      $("#chkCoolbag").click(function(){
                   
                    if(this.checked)
                   {
                     $("#texCoolbag").removeAttr("disabled");
                    $("#butCoolbag").removeAttr("disabled");
                      $("#butCoolbag").css("background-color","#007930");
                   }
                   else
                   {
                     $("#texCoolbag").attr("disabled","true");
                    $("#butCoolbag").attr("disabled","true");
                    $("#texCoolbag").val("");
                      $("#butCoolbag").css("background-color","#BEBEBE");
                   }
                    Calculate();
                    });
                      //表单提交
          AjaxInitForm('order_form', 'btnSubmit', 0);
                   $("#cbox").click(function(){
                    $(".checkall").prop("checked", false);
        $(this).prop("checked", true);
                   if(document.getElementById("cbox").checked)
                   {
                   $("#zhe").attr("disabled","true");
                    $("#ku").attr("disabled","true");
               $("#ku").val("");
                  $("#zhe").css("background-color","#BEBEBE");
                     $("#multiTEXT").removeAttr("disabled");
                   $("#sbu").removeAttr("disabled");
                   $("#sbu").css("background-color","#007930");
                     $("#liping").attr("disabled","true");
                    $("#libtn").attr("disabled","true");
                     $("#liping").val("");
                  $("#libtn").css("background-color","#BEBEBE");
                   Calculate();
                   }else
                   {
                     $("#multiTEXT").attr("disabled","true");
                    $("#sbu").attr("disabled","true");
                 
                  $("#sbu").css("background-color","#BEBEBE")
                   }
                    }
                    );
                     $("#cok1").click(function(){
                    $(".checkall").prop("checked", false);
        $(this).prop("checked", true);
                   if(document.getElementById("cok1").checked)
                   {
                     $("#zhe").removeAttr("disabled");
                   $("#ku").removeAttr("disabled");
                   $("#zhe").css("background-color","#007930")
                     $("#multiTEXT").attr("disabled","true");
                    $("#sbu").attr("disabled","true");
                  $("#multiTEXT").val("");
                  $("#sbu").css("background-color","#BEBEBE");
                   $("#liping").attr("disabled","true");
                    $("#libtn").attr("disabled","true");
                     $("#liping").val("");
                  $("#libtn").css("background-color","#BEBEBE");
                  Calculate();
                   }else
                   {
                     $("#zhe").attr("disabled","true");
                    $("#ku").attr("disabled","true");
                 
                  $("#zhe").css("background-color","#BEBEBE");
                   }
                    }
                    );
                        $("#cbox2").click(function(){
                    $(".checkall").prop("checked", false);
        $(this).prop("checked", true);
                   if(document.getElementById("cbox2").checked)
                   {
                     $("#liping").removeAttr("disabled");
                   $("#libtn").removeAttr("disabled");
                   $("#libtn").css("background-color","#007930")
                     $("#multiTEXT").attr("disabled","true");
                    $("#sbu").attr("disabled","true");
                  $("#multiTEXT").val("");
                  $("#sbu").css("background-color","#BEBEBE");
                    $("#zhe").attr("disabled","true");
                    $("#ku").attr("disabled","true");
               $("#ku").val("");
                  $("#zhe").css("background-color","#BEBEBE");
                  Calculate();
                   }else
                   {
                     $("#liping").attr("disabled","true");
                    $("#libtn").attr("disabled","true");
                 
                  $("#libtn").css("background-color","#BEBEBE");
                   }
                    }
                    );
//                        var myDate = new Date();
//                      if(new Date().getHours()<12)
//	        {
//	        myDate.setDate(myDate.getDate() + 2);
//	        }
//	        else
//	        {
//	          myDate.setDate(myDate.getDate() + 3);
//	        }
//                     	var ellength=$( ".ddd" ).length;
//myDate.setDate(myDate.getDate() -1);
<%set int starti=ls1.Count%>
var starti={starti};
                           $( ".el" ).each(function(){
						    <%if(ls1[0].type==3) %>
						 var dd=testwile(starti);
                         <%else %>
                         var dd=new Date();
                          dd.setDate(dd.getDate() + 2);
                         <%/if%>
						  $(this).datepicker({
			"minDate":  dd,
                                showOtherMonths: true,
                                selectOtherMonths: true,
                                 beforeShowDay: function (date) {
	               
	                    return selectedDate(date, starti, 0);
	              

	            }
		});
						  
						  
   
  });
                          
                       <%if(!IsUserLogin())%>
                       login();
                   <%else%>
                   <%if(addcount==0)%>
                  <%if(ls1.Count==0)%>
                  
                     window.location.href="goods.aspx";
                     <%/if%>
                      <%if(ls1[0].type!=2)%>
                     user_address_add();
                    <%/if%>
                     <%/if%>
                       <%/if%>
                    });
                    function user_address_add()
                    {
                    var dialog = $.dialog({
                   title:"请添加收货地址",
                   content: "url:<%linkurl("accept")%>",
                   min: false,
                   max: false,
                    lock: true,
                  close:function(){ location.reload(true);}
                  
                  });
                    }
                    
                    function test(obj)
                    {
                    if($(obj).val()=="0")
                    {
                     user_address_add();
                    }
                    else
                    {
                     <%if(ls1[0].type==3) %>
                      Calculate();
                      <%/if%>
                    }
                    }
                    function Calculate()
{
  var goods_amount = $("#ddr").val(); //商品总金额
        //手续费
       var order_amount = goods_amount;
    
         if($("#multiTEXT").val()!="")
         {
           var temp = $("#multiTEXT");
          var payment_fee = temp.val();
           var order_amount = goods_amount * payment_fee;
       
        if(payment_fee>=8)
        {
          var order_amount = order_amount *0.85;
      
        }
        else if(payment_fee>=5)
        {
        var order_amount = order_amount *0.90;
        }
        else if(payment_fee>=3)
        {
         var order_amount = order_amount *0.95;
        }
        }else
        {
       var order_amount=goods_amount;
       
        }
        var zhe=$("#ku").length>0?$("#ku").val():"";
        var liping=$("#liping").length>0?$("#liping").val():"";
        if(zhe!="")
        {
        $.ajax({
            type: "post",
            url: "{config.webpath}tools/submit_ajax.ashx?action=theyard",
            data:{ "sn" : zhe,"type":"zhe"},
            dataType: "json",
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.dialog.alert('尝试发送失败，错误信息：' + errorThrown, function () { }, winObj);
            },
            success: function (data, textStatus) {
           
                if (data.status == "1") {
                var order_amount = $("#ddr").val();

                if($("#addcount").val()=="1")
                {
              if(data.code=="1天")
              {
                 if(data.sn=="8.5")
                {
              
                 var order_amount = order_amount *0.85;
                  
                }else
                {
               
                  var order_amount = order_amount *0.50;
                   
                }
                  }else
                  {
                  alert("您所使用的是3天折扣码,请重新选择您的计划!");
                  }
                }else
                {
               
                   if(data.code=="3天")
              {
                if(data.sn=="8.5")
                {
              
                 var order_amount = order_amount *0.85;
                  
                }else
                {
               
                  var order_amount = order_amount *0.50;
                   
                }
                  }else
                  {
                    alert("您所使用的是1天折扣码,请重新选择您的计划!");
                  }
                   
                }
                
               
             
              
          var d = $(".addrss");
       
        var v = 0;
         $("#addfive").val(0);
       for(var i=0; i < d.length; i++) {
     
          var ddrsc=$(d[i]).find("option:selected").attr("title");
     if(ddrsc=="50")
     {
          v=v+=parseFloat(50);
        $("#addfive").val(parseInt($("#addfive").val())+1);
          }
      }
       
     // alert(parseFloat(order_amount).toFixed(2));
      $("#shipping").text(v);
      if($("#texCoolbag").val()!="")
         {
          var temp = $("#texCoolbag");
          var payment_fee = 28 *temp.val();
         
           var order_amount =parseFloat(order_amount)+parseFloat(payment_fee);
           
         }
         $("#goods_amount").text(parseFloat(order_amount).toFixed(2));
        var order_amount=parseFloat(order_amount)+parseFloat($("#shipping").text());
         
        $("#order_amount").text(order_amount.toFixed(2));
                } else {
                  alert(data.msg);
                }
            }
        });
        }
        else if(liping!="")
        {
         $.ajax({
            type: "post",
            url: "{config.webpath}tools/submit_ajax.ashx?action=theyard",
            data:{ "sn" : liping,"type":"li"},
            dataType: "json",
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.dialog.alert('尝试发送失败，错误信息：' + errorThrown, function () { }, winObj);
            },
            success: function (data, textStatus) {
           
                if (data.status == "1") {
                var order_amount = $("#ddr").val();
                if($("#addcount").val()=="1")
                {
              if(data.sn=="1天")
              {
                 var order_amount =0;
                  }else
                  {
                  alert("您所使用的是3天礼品码,请重新选择您的计划!");
                  }
                }else
                {
               
                   if(data.sn=="3天")
              {
                 var order_amount =0;
                  }else
                  {
                    alert("您所使用的是1天礼品码,请重新选择您的计划!");
                  }
                   
                }
               
          
              
          var d = $(".addrss");
       
        var v = 0;
         $("#addfive").val(0);
       for(var i=0; i < d.length; i++) {
     
          var ddrsc=$(d[i]).find("option:selected").attr("title");
     if(ddrsc=="50")
     {
          v=v+=parseFloat(50);
        $("#addfive").val(parseInt($("#addfive").val())+1);
          }
      }
       
     // alert(parseFloat(order_amount).toFixed(2));
      $("#shipping").text(v);
      if($("#texCoolbag").val()!="")
         {
          var temp = $("#texCoolbag");
          var payment_fee = 28 *temp.val();
         
           var order_amount =parseFloat(order_amount)+parseFloat(payment_fee);
           
         }
         $("#goods_amount").text(parseFloat(order_amount).toFixed(2));
        var order_amount=parseFloat(order_amount)+parseFloat($("#shipping").text());
         
        $("#order_amount").text(order_amount.toFixed(2));
                } else {
                  alert(data.msg);
                }
            }
        });
        }
        else
        {
       
         var d = $(".addrss");
       
        var v = 0;
         $("#addfive").val(0);
       for(var i=0; i < d.length; i++) {
     
          var ddrsc=$(d[i]).find("option:selected").attr("title");
     if(ddrsc=="50")
     {
          v=v+=parseFloat(50);
        $("#addfive").val(parseInt($("#addfive").val())+1);
          }
      }
      //alert(0);
      var sellc=$("#selliaochng");
      if(sellc.length>0)
      {
     // alert(1);
       var data = $("#selliaochng").find("option:selected").attr("title");
      if($("#addcount").val()<=parseInt(data))
       {
      //alert(2);
      //  $("#goods_amount").text(0);
     var order_amount =0;
      $("#goods_amount").text(0);
       }
        }
     // alert(parseFloat(order_amount).toFixed(2));
      $("#shipping").text(v);
     if($("#texCoolbag").val()!="")
         {
          var temp = $("#texCoolbag");
          var payment_fee = 28 *temp.val();
         
           var order_amount =parseFloat(order_amount)+parseFloat(payment_fee);
           
         }
      //alert(order_amount);
         $("#goods_amount").text(parseFloat(order_amount).toFixed(2));
         
        var order_amount=parseFloat(order_amount)+parseFloat($("#shipping").text());
         
        $("#order_amount").text(order_amount.toFixed(2));
        }
}
                   //发送AJAX请求
    function sendAjaxUrl(winObj, postData, sendUrl) {
        $.ajax({
            type: "post",
            url: sendUrl,
            data: postData,
            dataType: "json",
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $.dialog.alert('尝试发送失败，错误信息：' + errorThrown, function () { }, winObj);
            },
            success: function (data, textStatus) {
                if (data.status == 1) {
                    winObj.close();
                    $.dialog.tips(data.msg, 2, '32X32/succ.png', function () { location.reload(); }); //刷新页面
                } else {
                    $.dialog.alert('错误提示：' + data.msg, function () { }, winObj);
                }
            }
        });
    }
                    function login()
                    {
                    
              
               var dialog = $.dialog({
                  title:"login",
                   content: "url:<%linkurl("divlogin")%>",
                   min: false,
                   max: false,
                   lock: true
                  
                    });
                    }
                
              var dateall=[];
function dateadd(date,i)
{
for(var j=0; j<i;j++) {
    dateall.push(new  Date(date.setDate(date.getDate() + 1)));
}
}
function tests(datep,type,i) {
    if(dateall.length==0)
    {
    var setdate = new Date();
    setdate.setFullYear(2014, 3, 6);

    dateadd(setdate, 2+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 3, 29);
    }else
    {
     setdate.setFullYear(2014, 3, 30);
    }
    dateadd(setdate, 3+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 4, 30);
    }else
    {
    setdate.setFullYear(2014, 4, 31);
    }
    dateadd(setdate, 3+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 8, 5);
    }else
    {
      setdate.setFullYear(2014, 8, 6);
    }
    dateadd(setdate, 3+i);
    if(type==3)
    {
    setdate.setFullYear(2014, 8, 30);
    }else
    {
    setdate.setFullYear(2014, 9, 1);
    }
    dateadd(setdate, 7+i);
   }
    for (var i=0; i<dateall.length; i++)
    {
        if (new Date(dateall[i]).Format("yyyy-MM-dd") == datep.Format("yyyy-MM-dd")) {
            return true;
        }
       
       // alert(new Date(dateall[i]).Format("yyyy-MM-dd"));

    }
    return false;
}
function selectedDate(date, type, i) {



    var d = date.getDay();
    var ret=[true,'hasCourse'];
    if (tests(date, type, i)) {
      return [false, 'noCourse'];
    }
    if (type == 3) {
        if (d == 0 || d == 6 || d == 5 || d == 1) {
          return [false, 'noCourse'];

        }
    }
    else {
        if (d == 0 || d ==6) {
           return [false, 'noCourse'];

        }
        
    }


    return ret;
}
 function testwile(type) {
	        var myDate = new Date();

	        if (new Date().getHours() < 12) {
	            myDate.setDate(myDate.getDate() + 2);
	        }
	        else {
	            myDate.setDate(myDate.getDate() + 3);
	        }
	        if (type == 3) {
	            while (selectedDate(myDate, 3, 0)[0] == false) {
	                myDate.setDate(myDate.getDate() + 1);
	            }
	        }
	       return myDate;
	        
	    }    
	</script>
               </div>
               </form>
</div>
            <!--Footer-->
            <%template src="_footer.html" %>
              <!--/Footer-->